x86/vmx: Simplfy the default cases in vmx_msr_{read,write}_intercept()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 26 Feb 2018 14:23:03 +0000 (14:23 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 28 Feb 2018 18:05:27 +0000 (18:05 +0000)
commit62e80dff59c779cb56755b419120529e3d7eb17d
treefc6d9b332c6a1ea488d0674c6a4385ae735caebb
parentb68c4f1ebe4f413076c4915733a61c818b7dc73a
x86/vmx: Simplfy the default cases in vmx_msr_{read,write}_intercept()

The default case of vmx_msr_write_intercept() in particular is very tangled.

First of all, fold long_mode_do_msr_{read,write}() into their callers.  These
functions were split out in the past because of the 32bit build of Xen, but it
is unclear why the cases weren't simply #ifdef'd in place.

Next, invert the vmx_write_guest_msr()/is_last_branch_msr() logic to break if
the condition is satisfied, rather than nesting if it wasn't.  This allows the
wrmsr_hypervisor_regs() call to be un-nested with respect to the other default
logic.

No practical difference from a guests point of view.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
xen/arch/x86/hvm/vmx/vmx.c